<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>1.模态层</title>

<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<link href="../css/bootstrap.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.js"></script>

</head>

<!--<style type="text/css">
    /*可以重新定义此样式来设置模态层的大小*/
    .modal-dialog {
        width:800px;
    }
</style>-->

<script type="text/javascript">

    $(document).ready(function(e) {

        /*单击按钮弹出模态层*/
        $('#modalBtn').click(function(){
            $('#myModal').modal(
                    {
                        backdrop:'static', /*点击黑色区域不关闭*/
                        keyboard:false     /*ESC键不关闭*/
                    }
            );
        });

        /*模态层显示事件回调*/
        $('#myModal').on('show.bs.modal',function(e){
            alert('模态层被打开');
            //e.preventDefault();//阻止事件发生
        });

        /*模态层关闭事件回调*/
        $('#myModal').on('hidden.bs.modal',function(e){
            alert('模态层被关闭');
        });

    });

</script>
<body>
	
    <!--<div class="container">
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal"
                data-remote="../2.组件/1.字体图标.html">点击弹出模态层</button>
    </div>
    
    &lt;!&ndash;模态层&ndash;&gt;
    <div class="modal fade" id="myModal" tabIndex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    	<div class="modal-dialog">
        	<div class="modal-content">
            	&lt;!&ndash;<div class="modal-body">
                	这是我的模态层的内容
                </div>&ndash;&gt;
            </div>
        </div> 
    </div>-->


    <div class="container">
        <button type="button" class="btn btn-primary" id="modalBtn">点击弹出模态层</button>
    </div>

    <!-- 模态层 - 程序控制 -->
    <div class="modal fade" id="myModal" tabIndex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="text-center">模态层标题</h4>
                </div>
                <div class="modal-body">
                    这是我的模态层的内容
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">立即注册</button>
                </div>
            </div>
        </div>
    </div>

</body>
</html>